#include <bits/stdc++.h>

using namespace std;

long long a, b, c = 1;

int main() {
    cin >> a >> b;
    
    if (a == 1) {
        cout << 1;
        return 0;
    }
    for (int i = 1; i <= b; i++) {
        c *= a;
        if (c > (long long) 1e9){
            cout << -1; return 0;
        }
    }
    cout << c << endl;
    return 0;
}
